<template>
  <div>
      <table>
          <tr>
              <td>商品名称</td>
              <td>商品价格</td>
              <td>商品图片</td>
              <td>操作</td>
          </tr>
          <tr v-for="a in bb">
              <td>{{a.name}}</td>
              <td>{{a.price}}</td>
              <td><img :src="'http://localhost:8000'+a.pic" alt="" width="100" height="100"></td>
              <td>
                  <button @click="aa(a.id)">删除</button>
              </td>
              <td>
                  <button @click="sc()">添加</button>
              </td>
          </tr>
          
      </table>
  </div>
</template>

<script>
export default {
    data(){
        return{
            bb:[]
        }
    },
    methods:{
       abb(){
            this.$axios.get('bb/').then(item=>{
                this.bb = item.data
            })
        },
        aa(id){
            this.$axios.delete('cc/'+id).then(item=>{
               this.abb();

            })
        },
        sc(){
            this.$router.push(`eee/`)
        }
    },
    mounted(){
     
        this.abb()
    }
}
</script>

<style>

</style>